package com.ww.boot.mybatis.enums;

import cn.hutool.core.util.ObjectUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 平台编码枚举值
 * @author lixizhou
 */
@Getter
@AllArgsConstructor
public enum PlatformCodeEnum {

	EB(1, "EB",true),
	SM(2, "SM",false),
	AM(3, "AM",true),
	WS(4, "WS",false),
	WH(5, "WH",true),
	JG(6, "JG",true),
	LZ(7, "LZ",true),
	AL(8, "AL",true),
	SP(9, "SP",true),
	JM(10, "JM",true),
	TH(11, "TH",true),
	WM(12, "WM",true),
	SF(13, "SF",true),
	SH(14, "SH",true),
	PT(15, "PT",true),
	ST(16, "ST",true),
	WD(17, "WD",true),
	MM(18, "MM",true),
	SQ(19, "SQ",true),
	JU(20, "JU",true),
	EY(21, "EY",true),
	CD(22, "CD",true),
	YD(23, "YD",true),
	OB(24, "OB",true),
	FB(25, "FB",true),
	NN(26, "NN",true),
	FD(27, "FD",true),
	FM(28, "FM",true),
	NE(29, "NE",true),
	SY(30, "SY",true),
	ZM(31, "ZM",true),
	AI(32, "AI",true),
	BL(33, "BL",true),
	RT(34, "RT",true),
	VV(35, "VV",true),
	SD(36, "SD",true),
	US(37, "US",true),
	DZ(38, "DZ",true),
	MD(39, "MD",true),
	LB(40, "LB",true),
	KS(41, "KS",true),
	DH(42, "DH",true),
	TP(43, "TP",true),
	BB(44, "BB",true),
	BP(45, "BP",true),
	OZ(46, "OZ",true),
	BT(47, "BT",true),
	GU(48, "GU",true),
	TT(49, "TT",true),
	JX(50, "JX",true),
	PD(51, "PD",true),
	WF(52, "WF",true),
	FC(53, "FC",true),
	JD(54, "JD",true),
	WY(55, "WY",true),
	FN(56, "FN",true),
	LY(57, "LY",true),
	RE(58, "RE",true),
	HO(59, "HO",true),
	XS(60, "XS",true),
	SL(61, "SL",true),
	TG(62, "TG",true),
	FS(63, "FS",true),
	CP(64, "CP",true),
	MV(65, "MV",true),
	VH(66, "VH",true),
	//获取汇率通用code
	BASIC(0,"BASIC",true);

	final Integer id;
	final String value;
	final Boolean isSite;

	public static PlatformCodeEnum retrieval(int id) {
		for (PlatformCodeEnum item : values()) {
			if (item.getId() == id) {
				return item;
			}
		}
		return null;
	}

	/**
	 * 值是否在这个范围内
	 */
	public static Boolean isRange(Integer i){
		if(ObjectUtil.isNotEmpty(i) && i <= 62 && i>=1){
			return true;
		}else{
			return false;
		}
	}

	public static Integer getIdByValue(String value){
		for (PlatformCodeEnum platformCode : PlatformCodeEnum.values()) {
			if (platformCode.getValue().equals(value)){
				return platformCode.getId();
			}
		}
		return null;
	}
}
